package com.example.pointerdemo

import android.app.Activity
import android.content.Context
import android.util.AttributeSet
import android.util.Log
import androidx.appcompat.widget.AppCompatButton

/**
 * @Author xiao
 * @Date 2021/6/17
 * @Description
 */
class CustomBtn @JvmOverloads constructor(
    context: Context, attrs: AttributeSet? = null
) : AppCompatButton(context, attrs) {

    init {
        if (context is Activity) {
            Log.e("class", context::class.java.name)
        }
    }

    override fun setOnClickListener(l: OnClickListener?) {
        super.setOnClickListener {
            Log.e("hahaha", "点击了我")
            l?.onClick(it)
        }
    }
}